package mvc.controller;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 声明controller的第二种方式
 * 实现Controller接口
 * 不同实现Controller的方式需要不同的适配器来执行method
 * 所以需要寻找springmvc执行过程中需要寻找适配器
 * dispatcherServlet里面handlerMapping就两种类型
 *
 * @Author:ChenZhangKun
 * @Date: 2021/5/9 14:59
 */
@Component("/czk")// 此时czk就是执行请求的路径
public class InterfaceController implements Controller {
    @Override
    public ModelAndView handleRequest(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
        System.out.println("通过实现Controller接口定义controller");
        return null;
    }
}
